import requests
import json


# 返回商品详情的函数
def re_goods_detail(stylesn):
    import HenDaFuinterface.InterFace.token as token
    token = token.token()  # 获取token
    headers = {'content-type': 'application/json', 'token': token}  # 请求头
    payload = stylesn
    ret = requests.post("http://shop.5913ex.com/api/v1/goods/get", data=json.dumps(payload), headers=headers)
    # if(json.loads(ret.text)['code']==0):#判断返回是否正常
    #     data=(json.loads(ret.text)['data'])#取数据集
    #     total=len(data['goodsList'])#获取总条数
    #     print(total)
    # else:
    #     print("没有款号或者服务器返回错误")

    return json.dumps(ret.json(), ensure_ascii=False)
